var type = "WebGL";
if (!PIXI.utils.isWebGLSupported()) {
    type = "canvas";
}
PIXI.utils.sayHello(type);
var stage = new PIXI.Container();
var renderer = PIXI.autoDetectRenderer(256, 256);
document.body.appendChild(renderer.view);

PIXI.loader.add(['images/cat.png', 'images/tileset.png']).load(setup);

function setup() {
    var cat = new PIXI.Sprite(
        PIXI.loader.resources['images/cat.png'].texture
    );
    stage.addChild(cat);
    cat.position.set(96, 96);
    //cat.scale.set(2, 2);
    cat.anchor.set(0.5, 0.5);
    cat.rotation = 0;

    var texture = PIXI.utils.TextureCache['images/tileset.png'];
    var rectangle = new PIXI.Rectangle(96, 64, 32, 32);
    texture.frame = rectangle;
    var rocket = new PIXI.Sprite(texture);
    rocket.position.set(32, 32);
    stage.addChild(rocket);
    renderer.render(stage);
    setTimeout(function() {
        cat.visible = false;
        //renderer.render(stage);
    }, 500);
}
